﻿using System;
using IQIGame.Onigao.Framework;
using UnityEngine;

namespace IQIGame.Onigao.GamePlay
{
    public class Bullet : IReusableClass
    {
        public uint effect;
        public Vector3 startPos;
        public Vector3 curPos;
        public Vector3 targetPos;
        public float length;
        public Transform targetTrans;
        public BulletPath path;
        public float duration;
        public float curTime;
        public float startScale = 1;
        public float endScale = 1;
        public bool flyBack = false; // 当发射者与目标者距离过近时，可能存在发射点指向目标点与发射者指向目标者朝向相反的情况，这时倒着飞
        
        public Action onHit;
        public uint MaxStore => 3;
        public void OnReset()
        {
            this.effect = 0;
            this.startPos = default;
            this.curPos = default;
            this.targetPos = default;
            this.length = 0;
            this.targetTrans = null;
            this.path = null;
            this.duration = 0;
            this.curTime = 0;
            this.onHit = null;
            this.startScale = 1;
            this.endScale = 1;
            this.flyBack = false;
        }
    }
}